using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Storage;
using System.Diagnostics;

namespace WindowsGame
{
    public class Tile
    {
        #region Private fields

        private TileMap mBaseMap;
        private uint mTileGraphicsIndex;
        private bool mCollision;
        private TileRect mBounds;

        #endregion

        #region Public properties


        /// <summary>
        /// Gets and sets the tile graphics index
        /// </summary>
        public uint TileGraphicsIndex
        {
            get
            {
                return this.mTileGraphicsIndex;
            }
            set
            {
                if (this.mTileGraphicsIndex != value)
                {
                    this.mTileGraphicsIndex = value;
                }
            }
        }

        /// <summary>
        /// Gets and sets the collison value of this tile
        /// </summary>
        public bool Collision
        {
            get
            {
                return this.mCollision;
            }
            set
            {
                if (this.mCollision != value)
                {
                    this.mCollision = value;
                }
            }
        }

        /// <summary>
        /// Gets and sets the bounds of this tile
        /// </summary>
        public TileRect Bounds
        {
            get
            {
                return this.mBounds;
            }
            set
            {
                if (this.mBounds != value)
                {
                    this.mBounds = value;
                }
            }
        }

        #endregion

        #region Constructor / Destructor

        public Tile(TileMap baseMap)
        {
            this.mBaseMap = baseMap;
            this.mTileGraphicsIndex = 0;
            this.mCollision = false;
            this.mBounds = new TileRect(0, 0, this.mBaseMap.TileWidth, this.mBaseMap.TileHeight);
        }

        public Tile(TileMap baseMap, uint tileGraphicsIndex, bool collision)
        {
            this.mBaseMap = baseMap;
            this.mTileGraphicsIndex = tileGraphicsIndex;
            this.mCollision = collision;
            this.mBounds = new TileRect(0, 0, this.mBaseMap.TileWidth, this.mBaseMap.TileHeight);
        }

        public Tile(TileMap baseMap, uint tileGraphicsIndex, bool collision, Rectangle bounds)
        {
            this.mBaseMap = baseMap;
            this.mTileGraphicsIndex = tileGraphicsIndex;
            this.mCollision = collision;
            this.mBounds = new TileRect((int)bounds.X, (int)bounds.Y, (int)bounds.Width, (int)bounds.Height);
        }

        #endregion
    }
}
